<template>
  <div class="centerLeft1">
      <div class="h-title-box">
          <span class="h-title">任务通过率</span>
          <dv-decoration-3 class="h-deco"/>
        </div>
      <div class="charts-details">
        <VsCenterLeft1Chart />
      </div>
      <!-- 4个主要的数据 -->
      <div class="bottom-data">
        <div class="item-box" v-for="(item,index) in numberData" :key="index">
          <div class="d-flex">
            <span class="coin">￥</span>
            <dv-digital-flop :config="item.number" class="num" />
          </div>
          <p class="text" style="text-align: center;">
            {{item.text}}
            <span class="colorYellow">(件)</span>
          </p>
        </div>
      </div>
  </div>
</template>

<script>
import VsCenterLeft1Chart from "./charts/VsCenterLeft1Chart";
export default {
  components: {
    VsCenterLeft1Chart,
  },
  data() {
    return {
      config: {
        lineWidth: 30,
        activeRadius: "80%",
        radius: "75%",
        activeTimeGap: 2000,
        data: [
          {
            name: "周口",
            value: 55
          },
          {
            name: "南阳",
            value: 120
          },
          {
            name: "西峡",
            value: 78
          },
          {
            name: "驻马店",
            value: 66
          },
          {
            name: "新乡",
            value: 80
          }
        ]
      },
      numberData: [
        {
          number: {
            number: [15],
            toFixed: 1,
            content: "{nt}"
          },
          text: "今日构建总量"
        },
        {
          number: {
            number: [1144],
            toFixed: 1,
            content: "{nt}"
          },
          text: "总共完成数量"
        },
      ]
    };
  },

  mounted() {
    this.changeTiming();
  },
  methods: {
    changeTiming() {
      setInterval(() => {
        this.changeNumber();
      }, 3000);
    },
    changeNumber() {
      this.numberData.forEach((item, index) => {
        item.number.number[0] += ++index;
        item.number = { ...item.number };
      });
    }
  }
};
</script>

<style lang="less" scoped>
.centerLeft1{
    width: 100%;
    height: 100%;
  .charts-details{
    width: 100%;
    height: 70%;
  }
  .bottom-data{
    height:30%;
    .item-box{
      width:50%;
      float: left;
      margin-top: 20px;
      position: relative;
      .coin{
        font-size: 24px;
        color: #ffc107;
        position: absolute;
        left: -2px;
      }
    }
  }
  .d-flex{
    display: flex;
  }
  .num{
    width:100%;
    height: 30px;
    line-height: 30px;
  }
  .colorYellow{
    color:yellowgreen;
  }
}
</style>